<template>
  <div class="ma-content-block lg:flex justify-between p-4">
    <!-- CRUD 组件 -->
    <ma-crud :options="options" :columns="columns" ref="crudRef">
    </ma-crud>
  </div>
</template>
<script setup>
import {ref, reactive} from 'vue'
import temblorCanteenLeader from '@/api/temblor/temblorCanteenLeader'
import {Message} from '@arco-design/web-vue'
import tool from '@/utils/tool'
import * as common from '@/utils/common'

const crudRef = ref()


const options = reactive({
  id: 'temblor_canteen_leader',
  rowSelection: {
    showCheckedAll: true
  },
  pk: 'id',
  operationColumn: true,
  operationColumnWidth: 160,
  formOption: {
    viewType: 'modal',
    width: 600
  },
  api: temblorCanteenLeader.getList,
  add: {
    show: true,
    api: temblorCanteenLeader.save,
    auth: ['temblor:canteenLeader:save']
  },
  edit: {
    show: true,
    api: temblorCanteenLeader.update,
    auth: ['temblor:canteenLeader:update']
  },
  delete: {
    show: true,
    api: temblorCanteenLeader.deletes,
    auth: ['temblor:canteenLeader:delete']
  }
})

const columns = reactive([
  {
    title: "",
    dataIndex: "id",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    commonRules: {
      required: true,
      message: "请输入"
    }
  },
  {
    title: "",
    dataIndex: "userid",
    formType: "input",
    addDisplay: false,
    editDisplay: false,
    hide: true
  },
  {
    title: "用户",
    dataIndex: "userids",
    formType: "user-select",
    search: true,
    commonRules: {
      required: true,
      message: "请输入"
    },
    onlyId: true
  },
  {
    title: "类型",
    dataIndex: "type",
    formType: "select",
    search: true,
    commonRules: {
      required: true,
      message: "请输入类型"
    },
    multiple: false,
    dict: {
      data: [
        {
          label: "厨师",
          value: 1
        },
        {
          label: "食堂管理员",
          value: 2
        }
      ],
      translation: true
    }
  },
  {
    title: "",
    dataIndex: "created_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  },
  {
    title: "",
    dataIndex: "updated_at",
    formType: "date",
    addDisplay: false,
    editDisplay: false,
    hide: true,
    showTime: true
  }
])
</script>
<script> export default {name: 'temblor:canteenLeader'} </script>